home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / telecomm / misc / dcdd_23.lha / DCDDtime.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-10-02  |  5.0 KB  |  200 lines

  1. /* DCDDtime.rexx Version 1.3                                   941002.1717 */
  2.  
  3. address command
  4.  
  5. OPTIONS RESULTS
  6.  
  7. windev = "CON:150/50/380/110/DCDDtime "
  8.  
  9. if ~open('wind',windev) then exit      /* Window for all activity */
  10.  
  11. call J_DATE
  12.  
  13. call wsay(' ')
  14.  
  15. TotalBy = 'CRIS'
  16. call GetToday
  17. call GetTimeTitle
  18. call GetTotTime
  19.  
  20. X_temp= '   ONLINE CONNECT TIME FOR SERVICES BELOW ' 
  21.  
  22. call wsaych(X_temp)
  23. call wsay(' ')
  24. call wsay(' ')
  25.  
  26. X_temp= '      ' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')  ' - 'TotalBy'  - ' date('m',dateYYYYMMDDx,'s')
  27. call wsaych(X_temp)
  28.  
  29. TotalBy = 'LONGD'
  30. call GetToday
  31. call GetTimeTitle
  32. call GetTotTime
  33. X_temp= '             ' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')  ' - 'TotalBy' - ' date('m',dateYYYYMMDDx,'s') 
  34. call wsaych(X_temp)
  35.  
  36. TotalBy = 'LOCAL'
  37. call GetToday
  38. call GetTimeTitle
  39. call GetTotTime
  40. X_temp= '             ' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')  ' - 'TotalBy' - ' date('m',dateYYYYMMDDx,'s') 
  41. call wsaych(X_temp)
  42.  
  43. J_temp= '     the Amiga Era is now 'Jdate' days old'  
  44. call wsay(' ')
  45. call wsay(' ')
  46. call wsaych(J_temp)
  47. call wsay(' ')
  48. call wsay(' ')
  49. call wsay('         Press Return to continue')
  50. LetMeGo = readln('wind')
  51.  
  52. exit
  53.  
  54. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  55.  *                                                             *
  56.  *                   Functions / Subroutines                   *
  57.  *                                                             *
  58.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  59.  
  60.          /* Function - put string to window with EOL */
  61. wsay:
  62. parse arg strx
  63. call writeln('wind',strx)
  64. return
  65.  
  66.          /* Function - put string to window without EOL */
  67. wsaych:
  68. parse arg strx
  69. call writech('wind',strx)
  70. return
  71.  
  72.  
  73. GetToday:
  74.  
  75.   dateYYYY=left(date(sorted),4)               
  76.   dateYYYYMM=left(date(sorted),6)               
  77.   dateMM=right(dateYYYYMM,2)              
  78.   dateYYMMDD=right(date(sorted),6)              
  79.   dateDD=right(dateYYMMDD,2)              
  80. return
  81.  
  82.  
  83. GetTotTime:
  84.  
  85. /* gets total time for the month */
  86.  
  87.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  88.     thours = 0
  89.     tmins = 0                     /* If file doesn't exist, set to zero */
  90.     tsecs = 0
  91.   end
  92.  
  93.   else do
  94.     thours=readln('TotTime')      /* If file does exist, read them */
  95.     tmins=readln('TotTime')
  96.     tsecs=readln('TotTime')
  97.     call close('TotTime')
  98.   end
  99. return
  100.  
  101.  
  102. GetTimeTitle:
  103.  
  104.  
  105. /*
  106.  
  107.    Internet access has been added to DCDD and this has forced me to keep
  108.    monthly time totals for different SERVICES. I am using CRIS for my
  109.    Internet connection, LONGD for my long distance direct dialing, and
  110.    LOCAL for my local BBSes. The totals are controled the same as befor
  111.    by using NewBillDay and NewBillAdj. 
  112.  
  113.    If for instance NewBillDay = 8, and NewBillAdj = MINUS then the monthly
  114.    hours/minutes/seconds total will run from the 8th of one month till the
  115.    7th of the next month to match the way your phone company bills you.
  116.  
  117.    NewBillAdj is used to either put the first few days of this month into
  118.    last months totals (MINUS) or the last few days of this month into next
  119.    month (PLUS). (sort of crazy but it works!) 
  120.  
  121. */
  122.  
  123.  
  124. /* * * * * *  **************************************************  * * * * * */
  125. /* *********     BE SURE TO PUT THE DATA BELOW INTO DCDD.rexx     ********* */
  126. /* * * * * *  **************************************************  * * * * * */
  127.  
  128.   if TotalBy = ' ' then do
  129.      TotalBy = 'LONGD'
  130.      NewBillDay = 08
  131.      NewBillAdj = 'MINUS'
  132.   end 
  133.  
  134.   if TotalBy = 'LONGD' then do
  135.      NewBillDay = 08
  136.      NewBillAdj = 'MINUS'
  137.   end 
  138.  
  139.   if TotalBy = 'CRIS' then do
  140.      NewBillDay = 13
  141.      NewBillAdj = 'MINUS'
  142.   end 
  143.  
  144.   if TotalBy = 'LOCAL' then do
  145.      NewBillDay = 00
  146.      NewBillAdj = 'NONE'
  147.   end 
  148.  
  149. /* * * * * *  **************************************************  * * * * * */
  150. /* *********     BE SURE TO PUT THE DATA ABOVE INTO DCDD.rexx     ********* */
  151. /* * * * * *  **************************************************  * * * * * */
  152.  
  153.   dateMMx = dateMM
  154.   dateYYYYx = dateYYYY
  155.  
  156.   if NewBillAdj = "MINUS" then do
  157.      if dateDD < NewBillDay then do
  158.         if dateMM = 01 then do
  159.            dateMMx = 12
  160.            dateYYYYx = dateYYYY - 1
  161.            end
  162.         else do
  163.            dateMMx = dateMM - 1
  164.            if dateMMx < 10 then 
  165.               dateMMx = 0||dateMMx
  166.            end
  167.      end
  168.   end
  169.  
  170.   if NewBillAdj = "PLUS" then do
  171.      if dateDD ~ < NewBillDay then do
  172.         if dateMM = 12 then do
  173.            dateMMx = 01
  174.            dateYYYYx = dateYYYY + 1
  175.            end
  176.         else do
  177.            dateMMx = dateMM + 1
  178.            if dateMMx < 10 then
  179.               dateMMx = 0||dateMMx
  180.            end
  181.      end
  182.   end
  183.   timetitle='dh0:DemonDialer/DCDDtime_'totalby||'_'||dateYYYYx||dateMMx
  184.   dateYYYYMMDDx = dateYYYYx||dateMMx||dateDD 
  185.  
  186.   if NewBillAdj = "NONE" then do
  187.      timetitle='dh0:DemonDialer/DCDDtime_'totalby||'_'||dateYYYYMM
  188.      dateYYYYMMDDx = dateYYYY||dateMM||dateDD 
  189.      end
  190.   
  191.   return
  192.  
  193.  
  194. J_DATE:
  195.  
  196. dateYYYYMMDD = left(date(sorted),8)
  197. JDATE = date('i',dateYYYYMMDD,'s')
  198.  
  199. return
  200.